package gui.catalogues.customElements;

import java.util.List;

import javax.swing.table.AbstractTableModel;

import model.Person;

public abstract class TableModel extends AbstractTableModel {
	private List<Object> itemList;
	private String[] colNames = {"Id", "Name", "Surname", "e-mail", "teléfono"};
	
	public abstract void setColumnNames(String[] colNames);

	public abstract void setItemList(List<Object> itemList);
	
	/* (non-Javadoc)
	 * @see javax.swing.table.AbstractTableModel#getColumnName(int)
	 */
	@Override
	public String getColumnName(int column) {
		//return super.getColumnName(column);
		// reloaded to:
		return colNames[column];
	}

	@Override
	public int getRowCount() {
		if(itemList == null) return 0;
		//System.out.println("PersonTableModel.getRowCount.peopleList.size(): " + peopleList.size());
		return itemList.size();
	}

	@Override
	public int getColumnCount() {
		return colNames.length;
	}

	@Override
	public abstract Object getValueAt(int rowIndex, int columnIndex);
//	{
//		Object objectItem = itemList.get(rowIndex);
//		switch (columnIndex) {
//		case 0:
//			return objectItem.getId();
//		case 1:
//			return objectItem.getName();
//		case 2:
//			return objectItem.getSurname();
//		case 3:
//			return objectItem.getIdCollateralClient();
//		case 4:
//			return objectItem.getColClient();
//		default:
//			return null;
//		}
//	}
}